<template>
    <div>
        {{ text }}
    </div>
    <button @click="setText">设置1</button>
    <button @click="setText">设置2</button>
</template>
<script>
export default{
    return{
        text:'',
        fata1: null,
        fata2: null,
    }
},
methods: {
    setText(){
        // this.text = '1'
        // setTimeout(() =>{
        //  this.text = '2'
        // },2000)
        // console.log(6666666, this)
        const self = this
        setTimeout(function(){
            console.Iog(999999)
            self.text = '2'
        }, 1000)
        console.Iog(123123123)
    },
    setText2(){
        const pro = new Promise((resolv,reject)=> {
            setTimeout(()=>{
                console.log(111111)
                this.data1 = 2
                resolv(this.data1)
            },2000)
        })
        // console.log(pro)
    },
}
</script>